﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;

namespace VideoRentalShop.Model
{
    public class Client
    {
        public Client()
        {
            Orders = new ObservableCollection<Order>();
        }


        [Required]
        public long Id { get; set; }

        [Required]
        public DateTime CreateDate { get; set; }

        [Required]
        [MinLength(1)]
        [MaxLength(30)]
        public string Name { get; set; }
        
        [Required]
        [MinLength(1)]
        [MaxLength(30)]
        public string LastName { get; set; }
        
        [Required]
        public bool Blocked { get; set; }

        [RegularExpression(@"^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$")]
        public string Email { get; set; }
        
        [Required]
        [RegularExpression(@"^\d{11}$")]
        public string Pesel { get; set; }

        [Required]
        [MinLength(1)]
        [MaxLength(30)]
        public string Street { get; set; }

        [Required]
        [RegularExpression(@"^\d{2}\-\d{3}$")]
        public string PostalCode { get; set; }

        [Required]
        [MinLength(1)]
        [MaxLength(30)]
        public string City { get; set; }

        public virtual ObservableCollection<Order> Orders { get; private set; }
    }
}
